package com.mall.user.domain.model;

import com.mall.goods.common.config.ShopConfig;
import com.mall.goods.common.util.Common;

public record AppImageUrl(String url) {
    public AppImageUrl {
        if (url == null || url.isEmpty()) {
            url = ShopConfig.getPublicRoot() + Common.DEFAULT_CATEGORY_APP_IMAGE;
        } else {
            url = ShopConfig.getUploadRoot() + url;
        }
    }

    public static AppImageUrl of(String url) {
        return new AppImageUrl(url);
    }
}
